/**
 * 
 */
package com.dycn.posdashboard.services;

import java.util.Date;
import java.util.List;

import com.dycn.posdashboard.data.Branch2MerchantMapping;
import com.dycn.posdashboard.data.PaginatedInfor;
import com.dycn.posdashboard.data.PosTransactionData;
import com.dycn.posdashboard.data.PosTransactionDataStats;
import com.dycn.posdashboard.data.ServicesResultObject;
import com.dycn.posdashboard.data.StatsData001;
import com.dycn.posdashboard.data.StatsData002;
import com.dycn.posdashboard.data.StatsData003;
import com.dycn.posdashboard.data.StatsTimeUnit;

/**
 * @author gongqiyi
 *
 */
public interface PosTradeServices extends CommonServices{
	
	/**
	 * 
	 * @param dbSource
	 * @param branchNo
	 * @param startTime
	 * @param endTime
	 * @param nonDataPaginatedInfor
	 * @return
	 */
	public ServicesResultObject<PaginatedInfor<PosTransactionData>> getBranchPosTransactionDataListBy(String dbSource, 
			String branchNo, Date startTime,Date endTime,
			PaginatedInfor<PosTransactionData> nonDataPaginatedInfor);
	
	/**
	 * 
	 * @param dbSource
	 * @param merchantNo
	 * @param startTime
	 * @param endTime
	 * @param nonDataPaginatedInfor
	 * @return
	 */
	public ServicesResultObject<PaginatedInfor<PosTransactionData>> getMerchantPosTransactionDataListBy(String dbSource, 
			String merchantNo, Date startTime,Date endTime,
			PaginatedInfor<PosTransactionData> nonDataPaginatedInfor);
	

	/**
	 * 
	 * @param dbSource
	 * @param cardNo
	 * @param startTime
	 * @param endTime
	 * @param nonDataPaginatedInfor
	 * @return
	 */
	public ServicesResultObject<PaginatedInfor<PosTransactionData>> getCardPosTransactionDataListBy(String dbSource, 
			String cardNo, Date startTime,Date endTime,
			PaginatedInfor<PosTransactionData> nonDataPaginatedInfor);
	
	/**
	 * 
	 * @param dbSource
	 * @param startTime
	 * @param endTime
	 * @param nonDataPaginatedInfor
	 * @return
	 */
	public ServicesResultObject<PaginatedInfor<PosTransactionData>> getAllPosTransactionDataListBy(String dbSource,Date startTime,Date endTime,
			PaginatedInfor<PosTransactionData> nonDataPaginatedInfor);
	
	
	/**
	 * 
	 * @param dbSource
	 * @param branchNo
	 * @param merchantNo
	 * @param cardNo
	 * @param startTime
	 * @param endTime
	 * @param nonDataPaginatedInfor
	 * @return
	 */
	public ServicesResultObject<PaginatedInfor<PosTransactionData>> getPosTransactionDataListBy(String dbSource, String branchNo,String merchantNo,String cardNo, Date startTime, Date endTime,
	PaginatedInfor<PosTransactionData> nonDataPaginatedInfor);
	
	/**
	 * 
	 * @param dbSource
	 * @param branchNo
	 * @param merchantNo
	 * @param cardNo
	 * @param recentSecond
	 * @return
	 */
	public ServicesResultObject<List<PosTransactionData>> getRecentPosTransactionDataListBy(String dbSource, String branchNo,String merchantNo,String cardNo, Date lastUpdateCheckStartTime,int recentSecond);
	
	
	/**
	 * 各个商家(在某个分公司下)的消费金额占有率信息
	 * @param dbSource
	 * @param merchantNo
	 * @param startTime
	 * @param endTime
	 * @return
	 */
	public ServicesResultObject<List<PosTransactionDataStats>> getMercantTradeMoenyOccupancy(String dbSource,String branchNo, Date startTime,Date endTime);

	public ServicesResultObject<Branch2MerchantMapping> getBranch2MerchantMappingInfo(String dbSource);
	
	/**
	 * 各个分公司的消费金额占有率信息
	 * @param dbSource
	 * @param merchantNo
	 * @param startTime
	 * @param endTime
	 * @return
	 */
	public ServicesResultObject<List<PosTransactionDataStats>> getBranchTradeMoenyOccupancy(String dbSource,Date startTime,Date endTime);
	
	//商家的刷卡平均价格分布
	//日/月/年
	public ServicesResultObject<List<PosTransactionDataStats>> getMercantAveragTradeMoeny(String dbSource,String branchNo, Date startTime,Date endTime,StatsTimeUnit statsTimeUnit);
	
	//卡的平均消费价格分布
	public ServicesResultObject<List<PosTransactionDataStats>> getCardOwnerAveragTradeMoeny(String dbSource, Date startTime,Date endTime,StatsTimeUnit statsTimeUnit);
	
	//各个分公司的消费金额 分布
	public ServicesResultObject<List<PosTransactionDataStats>> getBranchTradeMoenyOccupancy(String dbSource, Date startTime,Date endTime,StatsTimeUnit statsTimeUnit);
	
	//各个商家(在某个分公司下)消费金额  走势 统计
	public ServicesResultObject<List<PosTransactionDataStats>> getMerchantTradeMoenyOccupancy(String dbSource,String branchNo, Date startTime,Date endTime,StatsTimeUnit statsTimeUnit);
	
	
	/**
	 * 以卡为单位统计交易信息
	 * @param dbSource
	 * @param startTime
	 * @param endTime
	 * @param statsTimeUnit
	 * @return
	 */
	public ServicesResultObject<PaginatedInfor<PosTransactionDataStats>> getPosTradeStatsByCardNo(String dbSource,Date startTime,Date endTime,StatsTimeUnit statsTimeUnit,PaginatedInfor<PosTransactionDataStats> nonDataPaginatedInfor);
	
	/**
	 * 统计一个特定商户的交易信息
	 * @param dbSource
	 * @param terminalMerchantNo
	 * @param startTime
	 * @param endTime
	 * @param nonDataPaginatedInfor
	 * @return
	 */
	public ServicesResultObject<PaginatedInfor<PosTransactionDataStats>> getPosTradeStatsByTerminalMerchantNo(String dbSource,String terminalMerchantNo,Date startTime,Date endTime,PaginatedInfor<PosTransactionDataStats> nonDataPaginatedInfor);
	
	/**
	 * 统计一个特定分公司的交易信息
	 * @param dbSource
	 * @param branchNo
	 * @param startTime
	 * @param endTime
	 * @param nonDataPaginatedInfor
	 * @return
	 */
	public ServicesResultObject<PaginatedInfor<PosTransactionDataStats>> getPosTradeStatsByBranch(String dbSource,String branchNo,Date startTime,Date endTime,PaginatedInfor<PosTransactionDataStats> nonDataPaginatedInfor);
	
	
	public ServicesResultObject<PaginatedInfor<PosTransactionDataStats>> getMerchantPosTradeStatsByBranch(String dbSource,String branchNo,Date startTime,Date endTime,PaginatedInfor<PosTransactionDataStats> nonDataPaginatedInfor);
	/**
	 * 统计以日为单位的消费信息，
	 * 并且返回的数据长度与startTime endTime 之间天数N
	 * 如果实际数据长度不足N，那么必须不足
	 * @param dbSource
	 * @param branchNo
	 * @param terminalMerchantNo
	 * @param startTime
	 * @param endTime
	 * @return
	 */
	public ServicesResultObject<List<StatsData001>> queryStatsData001(String dbSource,String branchNo,String terminalMerchantNo,Date startTime,Date endTime);
	
	/**
	 * 
	 * @param dbSource
	 * @param branchNo
	 * @param terminalMerchantNo
	 * @param startTime
	 * @param endTime
	 * @return
	 */
	public ServicesResultObject<List<StatsData002>> queryStatsData002(String dbSource,String branchNo,String terminalMerchantNo,Date startTime,Date endTime);
	
	/**
	 * 
	 * @param dbSource
	 * @param branchNo
	 * @param terminalMerchantNo
	 * @param startTime
	 * @param endTime
	 * @return
	 */
	public ServicesResultObject<List<StatsData003>> queryStatsData003(String dbSource,String branchNo,String terminalMerchantNo,Date startTime,Date endTime);
	
	/**
	 * 
	 * @param dbSource
	 * @param branchNo
	 * @param terminalMerchantNo
	 * @param startTime
	 * @param endTime
	 * @param stateTimeUnit
	 * @return
	 */
	public ServicesResultObject<List<StatsData001>> queryStatsData(
			String dbSource, String branchNo, String terminalMerchantNo,
			Date startTime, Date endTime,StatsTimeUnit stateTimeUnit) ;
	
}
